package cn.hx.mall.sell.service.impl;

import cn.hx.mall.order.entity.PageModel;
import cn.hx.mall.sell.dao.SmsHomeRecommendSubjectDao;
import cn.hx.mall.sell.entity.SmsHomeRecommendSubject;
import cn.hx.mall.sell.service.SmsHomeRecommendSubjectService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 首页推荐专题表(SmsHomeRecommendSubject)表服务实现类
 *
 * @author makejava
 * @since 2022-11-02 16:10:32
 */
@Service("smsHomeRecommendSubjectService")
public class SmsHomeRecommendSubjectServiceImpl implements SmsHomeRecommendSubjectService {
    @Resource
    private SmsHomeRecommendSubjectDao smsHomeRecommendSubjectDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public SmsHomeRecommendSubject queryById(Long id) {
        return this.smsHomeRecommendSubjectDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<SmsHomeRecommendSubject> queryAllByLimit(int offset, int limit) {
        return this.smsHomeRecommendSubjectDao.queryAllByLimit(offset, limit);
    }


    /**
     * 新增数据
     *
     * @param smsHomeRecommendSubject 实例对象
     * @return 实例对象
     */
    @Override
    public SmsHomeRecommendSubject insert(SmsHomeRecommendSubject smsHomeRecommendSubject) {
        this.smsHomeRecommendSubjectDao.insert(smsHomeRecommendSubject);
        return smsHomeRecommendSubject;
    }

    /**
     * 修改数据
     *
     * @param smsHomeRecommendSubject 实例对象
     * @return 实例对象
     */
    @Override
    public SmsHomeRecommendSubject update(SmsHomeRecommendSubject smsHomeRecommendSubject) {
        this.smsHomeRecommendSubjectDao.update(smsHomeRecommendSubject);
        return this.queryById(smsHomeRecommendSubject.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long id) {
        return this.smsHomeRecommendSubjectDao.deleteById(id) > 0;
    }

    @Override
    public List<SmsHomeRecommendSubject> findAll(SmsHomeRecommendSubject smsHomeRecommendSubject) {
        return smsHomeRecommendSubjectDao.findAll(smsHomeRecommendSubject);
    }

    @Override
    public List<SmsHomeRecommendSubject> queryAll(SmsHomeRecommendSubject smsHomeRecommendSubject, int offset, int limit) {
        return smsHomeRecommendSubjectDao.queryAll(smsHomeRecommendSubject,offset,limit);
    }


    @Override
    public int count() {
        return smsHomeRecommendSubjectDao.count();
    }
}